﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace WoWConnecter
{
    public class AuthPacketIn : BasicPacketIn
    {
        public AuthServerOpCode Id
        {
            get { return (AuthServerOpCode)RawId; }
        }

        public override string ToString()
        {
            return Id.ToString();
        }

        public AuthPacketIn(byte[] buffer, int length)
        {
            Write(buffer, 0, length);
            PacketType = PacketType.Authentication;
        }

        public override int Write(byte[] buffer, int offset, int length)
        {
            BaseStream.Write(buffer, offset, length);

            return length - offset;
        }

        public override void FinalizePacket()
        {
            base.FinalizePacket();

            RawId = ReadByte();
        }
    }
}
